package com.daydaykeep;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CalendarView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.facebook.react.ReactRootView;
import com.facebook.react.views.text.ReactTextView;
import com.facebook.react.views.view.ReactViewGroup;

/**
 * Created by friddle on 5/25/16.
 */
public class TestActivity extends Activity{

    CalendarView cal_view;

    @Override
    public void onCreate(Bundle instances)
    {
        super.onCreate(instances);

        //for view
        ReactViewGroup view=(ReactViewGroup) this.createReactGroupView(this.getApplicationContext());
        view_layout.addView(this.createReactTextView(this.getApplicationContext()));


        //for linearlayout
        LinearLayout view_layout=new LinearLayout(this.getApplicationContext());
        view_layout.addView(this.createReactTextView(this.getApplicationContext()));

        this.setContentView(view_layout);
    }


    public View createReactRootView(Context context)
    {
        ReactRootView view=new ReactRootView(context);
        //view.setBackgroundColor(Color.YELLOW);
        view.setX(10.0f);
        view.setY(20.0f);
        return view;
    }

    public View createReactTextView(Context context)
    {
        ReactTextView textView=new ReactTextView(context);
        //TextView textView=new TextView(context);
        textView.setText("hello_world");
        textView.setTextColor(Color.BLACK);
        ViewGroup.LayoutParams params=new ViewGroup.LayoutParams(100,100);
        textView.setLayoutParams(params);
        return textView;
    }

    public View createReactGroupView(Context context)
    {
        ReactViewGroup group=new ReactViewGroup(context);
        group.setBackgroundColor(Color.BLUE);
        return group;
    }

    public View createCalendarView(Context context)
    {
        cal_view=new CalendarView(this.getApplicationContext());
        cal_view.setBackgroundColor(Color.GREEN);
        return cal_view;
    }

}
